<template>
    <view>
        <custom><template #backText>我的合约</template></custom>
        <list :list="data.list" empty_list_title="还没有合约">
            <template #list>
                <view class="cu-list menu">
                    <nMenuItemTopBottom v-for="(info, key) in data.list" :key="key">
                        <template #top>
                            <view class="text-nddyny text-bold">
                                <text class="text-deep-nddyny">ID: {{info.uas_id}}</text>
                                <text class="cuIcon-hot margin-left-20"></text>
                                <text class="margin-left-6">{{info.gold_share_remain_amount | floor}}</text>
                                <text class="cuIcon-hotfill margin-left-20"></text>
                                <text class="margin-left-6">{{info.gold_share_everyday_amount | floor}}</text>
                            </view>
                            <view class="text-green">{{info.prev_date | dateFormat('yyyy-MM-dd')}}</view>
                        </template>
                        <template #bottom>
                            <view class="text-gray">
                                <text>{{info.seeder_amount | floor}}合约</text>
                                <text class="margin-left-20">{{info.gold_share_amount | floor}}股</text>
                            </view>
                            <view class="flex align-center">
                                <view class="text-gray">{{info.start_date | dateFormat('yyyy-MM-dd')}}</view>
                                <view v-if="info.seeder_status == 0" class="bg-nddyny cu-tag margin-left-20">正常</view>
                                <view v-if="info.seeder_status == 1" class="bg-green cu-tag margin-left-20">完成</view>
                            </view>
                        </template>
                    </nMenuItemTopBottom>
                </view>
            </template>
        </list>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                data: {
                    offset: 0,
                    limit: 15,
                    stop: false,
                    list: [],
                },
            }
        },
        onLoad() {
            this.getList(this.$api.list_action_page_init);
        },
        onReachBottom() {
            this.getList(this.$api.list_action_add);
        },
        methods: {
            getList(action) {
                this.$api.list(this, {
                    action,
                    url: '/user/asset/seederList',
                    success: (Result) => {
                        if (this.$api.form.toast(this, Result)) return;
                        this.data.list = this.data.list.concat(Result.result.list);
                    }
                });
            },
        }
    }
</script>
